package com.rtmart.imageupload.Tools;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

public class DateTools {
    public static String dateToString(Date date){
        if (null != date){
            return new SimpleDateFormat("yyyy-MM-dd").format(date);
        }else {
            return null;
        }
    }
    public static Date stringToDate(String dateString){
        try {
            return new SimpleDateFormat("yyyyMMdd").parse(dateString);
        } catch (ParseException e) {
            e.printStackTrace();
            return null;
        }
    }
}
